#ifndef L3G4200D_H_INCLUDED
#define L3G4200D_H_INCLUDED

#define GYR_Mode_file "/sys/class/i2c-dev/i2c-2/device/2-0068/powermode"
#define GYR_Rate_file "/sys/class/i2c-dev/i2c-2/device/2-0068/datarate"
#define GYR_Data_file "/sys/class/i2c-dev/i2c-2/device/2-0068/gyrodata"
#define GYR_Range_file "/sys/class/i2c-dev/i2c-2/device/2-0068/range"
//#define GYR_Id_file "/sys/bus/i2c/drivers/l3g4200d/2-0068/id"
#define GYR_Name_file "/sys/class/i2c-dev/i2c-2/device/2-0068/name"


/* Gyrometer output data rate */
#define L3G4200D_RATE_100 0x00
#define L3G4200D_RATE_200 0x40
#define L3G4200D_RATE_400 0x80
#define L3G4200D_RATE_800 0xC0

/* ATTENTION BW et ODR (BandWidth and OutputDataRate liés, vérifier pour config !! */

/* Gyrometer powermode */
#define L3G4200D_PM_OFF					0x00
#define L3G4200D_PM_ON					0x01

/* Gyrometer range (fulls scale) */
#define L3G4200D_FS250					0x00 /* 250 degree/seconde */
#define L3G4200D_FS500					0x01
#define L3G4200D_FS2000					0x03

typedef struct {
	char name[16];
	//short updated;
	struct {
        int mode;
        int range;
        int rate;
        //int gain[2];
    } config;
	struct {
		int axis[3];
	} raw;
	struct {
		float axis[3];
	} filtered;
	struct {
		float bias[3];
		float scale[3];
		float variance[3];
		float tempcompfactor[3]; /* vérifier si dérive température dans données constructeur */
	} calibration;
	struct {    /* TODO ajouter dans driver réception température... */
		int xy;
		int z;
	} temp;
}gyr_sensor;

void reset_values_gyr(gyr_sensor *gyr);
int Gyr_Init(gyr_sensor *gyr);
int Gyr_write_config(gyr_sensor *gyr);
int Gyr_read_config(gyr_sensor *gyr);
int Gyr_read_data(gyr_sensor *gyr);

#endif // L3G4200D_H_INCLUDED
